Load Packages and Data

Cleaning Data

GTBK_turtle_measures <- GTBK_data %>%
  select(fecha, nombre_tortuga, marca_nombre, especie_nombre_latino, numero_recaptura, a_c_c,, l_c_c, lugar, geografía, sexo_correcto)
  
write_csv(GTBK_turtle_measures, file = ("data/GTBK_turtle_measures.csv"))

Counts

GTBK_data %>%
  group_by(especie_nombre_latino) %>%
count()  
## # A tibble: 5 × 2
## # Groups:   especie_nombre_latino [5]
##   especie_nombre_latino      n
##   <chr>                  <int>
## 1 Caretta caretta            2
## 2 Chelonia mydas           848
## 3 Eretmochelys imbricata     7
## 4 Lepidochelys olivacea     15
## 5 <NA>                       8

Visualizations

buis_2022 %>% 
  mutate(species = case_when(
    sp == "HB" ~ "Eretmochelys imbricata",
    sp == "GR" ~ "Chelonia mydas")
  ) %>% 
  ggplot(aes(x = species, y = cclnuct, fill = species)) +
  geom_violin() +
  scale_fill_manual(values = c("chartreuse4", "hotpink4")) + 
  theme_minimal() +
  coord_flip () +
  labs(title = "Average Curved Carapace Length of Green and Hawksbill Sea Turtles",
       subtitle = "Reproductive Females Measured During 2022 Nesting Season on Buck Island, USVI",
       x = "Species", 
       y = "Curved Carapace Length (cm)",
       fill = "Species")
## Warning: Removed 10 rows containing non-finite values (`stat_ydensity()`).

buis_2022 %>% 
  mutate(species = case_when(
    sp == "HB" ~ "Eretmochelys imbricata",
    sp == "GR" ~ "Chelonia mydas")
  ) %>% 
  ggplot(aes(x = species, y = cclnuct, fill = species)) +
  geom_boxplot() +
  scale_fill_manual(values = c("chartreuse4", "hotpink4")) + 
  theme_minimal() +
  coord_flip () +
  labs(title = "Average Curved Carapace Length of Green and Hawksbill Sea Turtles",
       subtitle = "Reproductive Females Measured During 2022 Nesting Season on Buck Island, USVI",
       x = "Species", 
       y = "Curved Carapace Length (cm)",
       fill = "Species")
## Warning: Removed 10 rows containing non-finite values (`stat_boxplot()`).

GTBK_data %>%
  filter(especie_nombre_latino == "Chelonia mydas" |
         especie_nombre_latino == "Eretmochelys imbricata" |
         especie_nombre_latino == "Lepidochelys olivacea" |
         especie_nombre_latino == "Caretta caretta") %>%
  ggplot(aes(x = especie_nombre_latino, y = a_c_c, fill = especie_nombre_latino)) +
  geom_boxplot() +
  scale_fill_manual(values = c("goldenrod1","chartreuse4", "hotpink4","cornflowerblue")) +
  theme_minimal() +
  coord_flip() +
  facet_wrap(~ geografía) +
  labs(title = "Curved Carapace Length Measurements of Four Sea Turtle Species",
       subtitle = "Monitored by GTBK in Kino Bay, Mexico between 2010-2023",
       x = "Species",
       y = "Curved Carapace Length (cm)",
       fill = "Species")
## Warning: Removed 1 rows containing non-finite values (`stat_boxplot()`).

GTBK_data %>% 
  filter(numero_recaptura %in% c(2, 3, 4)) %>% 
  ggplot(aes(x = numero_recaptura)) +
  geom_bar()

GTBK_data %>% 
  filter(numero_recaptura %in% c(2, 3, 4)) %>% 
  ggplot(aes(x = numero_recaptura, fill = sexo_correcto)) +
  geom_bar()

GTBK_data %>% 
  filter(numero_recaptura %in% c(1, 2, 3, 4)) %>% 
  filter(especie_nombre_latino == "Chelonia mydas" | 
         especie_nombre_latino == "Eretmochelys imbricata" |
         especie_nombre_latino == "Caretta caretta" |
         especie_nombre_latino == "Lepidochelys olivacea") %>% 
  ggplot(aes(x = numero_recaptura, fill = especie_nombre_latino)) +
  geom_bar() +
  scale_fill_manual(values = c("firebrick2", "darkseagreen", "royalblue4", "yellow2")) +
  theme_minimal() +
  labs(title = "Number of Sea Turtle Recaptures by GTBK",
       subtitle = "Of Four Sea Turtle Species in Kino Bay, Mexico",
       x = "Number of Times Recaptured",
       y = "Number of Turtles",
       fill = "Species")

# recapture_tibble <- GTBK_data %>%
#   group_by(marca_nombre) %>%
#   select(nombre_tortuga, fecha, especie, area_de_monitoreo, marca_nombre)
# 
# 
# recapture_tibble %>%
#   group_by(marca_nombre) %>%
#   summarize(marca_nombre)
GTBK_data %>%
  group_by(especie_nombre_latino) %>%
  count (sexo_correcto)
## # A tibble: 9 × 3
## # Groups:   especie_nombre_latino [5]
##   especie_nombre_latino  sexo_correcto     n
##   <chr>                  <chr>         <int>
## 1 Caretta caretta        Indefinido        2
## 2 Chelonia mydas         Hembra          339
## 3 Chelonia mydas         Indefinido      483
## 4 Chelonia mydas         Macho            26
## 5 Eretmochelys imbricata Indefinido        7
## 6 Lepidochelys olivacea  Hembra           10
## 7 Lepidochelys olivacea  Indefinido        1
## 8 Lepidochelys olivacea  Macho             4
## 9 <NA>                   <NA>              8
# GTBK_2018_2023 %>% 
#   group_by(especie_nombre_latino) %>% 
#   count(Sexo)

# GTBK_2010_2018 %>% 
#   group_by(Especie) %>% 
#   count(Sexo) 

buis_2022 %>% 
  group_by(sp) %>% 
  count(sex)
## # A tibble: 2 × 3
## # Groups:   sp [2]
##   sp    sex        n
##   <chr> <chr>  <int>
## 1 GR    female    27
## 2 HB    female    29
GTBK_data %>%
  filter(numero_recaptura == 1) %>%
  group_by(especie_nombre_latino) %>%
  count (sexo_correcto)
## # A tibble: 9 × 3
## # Groups:   especie_nombre_latino [5]
##   especie_nombre_latino  sexo_correcto     n
##   <chr>                  <chr>         <int>
## 1 Caretta caretta        Indefinido        2
## 2 Chelonia mydas         Hembra          248
## 3 Chelonia mydas         Indefinido      380
## 4 Chelonia mydas         Macho            23
## 5 Eretmochelys imbricata Indefinido        7
## 6 Lepidochelys olivacea  Hembra           10
## 7 Lepidochelys olivacea  Indefinido        1
## 8 Lepidochelys olivacea  Macho             4
## 9 <NA>                   <NA>              1
GTBK_data %>%
filter(especie_nombre_latino != "NA") %>%
  filter(numero_recaptura == 1) %>%
ggplot(aes(x = sexo_correcto, 
                     fill = sexo_correcto)) +
  geom_bar() + 
  facet_wrap( ~ especie_nombre_latino, 
              # <- fct_relevel(especie_nombre_latino, 
              #                         "Caretta caretta",
              #                          "Eretmochelys imbricata", 
              #                          "Lepidochelys olivacea",
              #                          "Chelonia mydas"),
               scales = "free_y") +
   labs(title = "Species and Sex Distribution", 
       subtitle = "of turtles captured in Kino Bay", 
       x = "sex", 
       y = "number of individuals", 
       fill = "sex") +
 scale_fill_manual(values = c("#cd4071","#feca8d", "#721f81", "#000004"))

naniar::gg_miss_var(GTBK_data)

visdat::vis_miss(GTBK_data)
## Warning: Raster pixels are placed at uneven horizontal intervals and will be shifted
## ℹ Consider using `geom_tile()` instead.

visdat::vis_miss(GTBK_2018_2023)

GTBK Recapture Visualizations

880 times went out total, 188 instances of recapture

GTBK_data <- GTBK_data %>%
  mutate(mes = month(fecha)) %>%
  mutate(año = year(fecha))


as.integer(GTBK_data$mes)
##   [1] 10 10 10 10  3  3  3 10  5 10  6  6  6  6  6  6  6  9  9  9 10  3  3  4  4
##  [26]  4  4  4  6  6  5 12  7  7 10 10 11 11 11 11 12 12 11 11 11 11  2  2  2  3
##  [51]  3  3  3  3  3  3  3  3  3  4  4  4 11 11 11  5  5  5  5  6  6  6  6  6  6
##  [76]  6  6  6  6  6  6  6  6  6  6  7  7  7  7  7  7  7  7  7  7  7  7  8  8  8
## [101]  8  8  8  8  8  8  8  9  9  9  9  5 10 10 10 10 10 10  1  1  1  1  1  3  3
## [126]  3  3  3  3  3  3 11 11 11 11 11 11  5 12  1  1  1  9  2  4  4  4  4  4  4
## [151]  4  5  5  5  5  5  5  5  5  3 11 11 11 11 11 12 12 12 12 12 12 12 12 12 11
## [176] 11 12 12 12 12 12 12 11 11 11 11 12 12 12 12 12 12 12  8  9  9  9  9 10 10
## [201] 10  7  7  7  7  7  7  7  8  8  8  8  8  8  8  8  8  8  9  9 10 10  5  5  5
## [226]  5  6  6  6  6  6  6  6  6  6  6  5  5  6  6  6  6  6  6 12 12 12 12 12  1
## [251]  1  3  3  3  3  3  3  3  3  3  3  3  3  3  4  4  4  4  4  4  4  4  4  4  4
## [276]  4  4  2  2  2  2  4  4  5  5  5  5  5  5  6  6  6  6  6  6  6  6  6  6  6
## [301]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  1  1  1  7  7  7  7
## [326]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  1  1  1  8  8  8
## [351]  8  8  8  8  8  8  8  8  8  8  8  8  9  9  9  9  9  6 10 10 10 10 10 10 10
## [376] 10 10 10 11 11 11 11 11  2  3  3  3  4  4  4  4  4  4  4  4  4  4  4  4  4
## [401]  6  6  6  6  6  6  6  6 NA 10  5  5  5  5  5  5  5  5  5  5  5  5  6  7  7
## [426]  7  7  7  7  7  7  7  8  8  8  8  8  8  8  8  8  9  9  9  9 10 NA 10 10 10
## [451] 10 10 10 10 10 10 10 10 10 10 10 11 11 12 12 12 12  2  2  3  3  3  3  3  3
## [476]  4  4  4  4  4  4  4  4  4  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
## [501]  5  5  5  5  5  5  5  5  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  7
## [526]  7  7  7  7  7  7  8  8  8  8  8  8  8  8  8  8  8  9  9  9  9  9  9  9  9
## [551]  9  9  9  9  9  9  9  9  9  9  9  9  9  9 10 10 10 10 10 10 10 10 10 10 10
## [576] 10 10 11 11 11 11 11 11 11 11 12 12 12 12 12 12 12 12 12 12 12 12  2  2  2
## [601]  3  3  3  3  3  3  3  3  3  3  3  3  3  4  4  4  5  5  5  5  5  5  5  5  5
## [626]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5 NA  6  6  6  6
## [651]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  7  7  7
## [676]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  8  8  8  8  8  9  9  9  9  9
## [701]  9 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 11 11 11
## [726] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 12 12 12 12 12 12 12 12 12 12  2
## [751]  2  3  3  3  3  3  3  3  3  3  3  3  3  4  4  4  4  4  4  4  4  4  4  4  4
## [776]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
## [801]  5  5  5  5  5  5  5  5  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
## [826]  6  6  6  6  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  8  8  8  8  8  8
## [851]  8  8  9  9  9  9  9  9  9  9  9  9  9  9  9 10 10 10 10 10 10 11 11 11 11
## [876] 11 11 11 11 11
as.integer(GTBK_data$año)
##   [1] 2010 2010 2010 2010 2011 2011 2011 2012 2012 2013 2013 2013 2013 2013 2013
##  [16] 2013 2013 2013 2013 2013 2013 2014 2014 2014 2014 2014 2014 2014 2014 2014
##  [31] 2014 2014 2014 2014 2014 2014 2014 2014 2014 2014 2014 2014 2015 2015 2015
##  [46] 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015
##  [61] 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015
##  [76] 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015
##  [91] 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015
## [106] 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015
## [121] 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015
## [136] 2015 2015 2015 2015 2016 2016 2016 2016 2016 2016 2016 2016 2016 2016 2016
## [151] 2016 2016 2016 2016 2016 2016 2016 2016 2016 2016 2016 2016 2016 2016 2016
## [166] 2016 2016 2016 2016 2016 2016 2016 2016 2016 2016 2016 2016 2016 2016 2016
## [181] 2016 2016 2016 2016 2016 2016 2016 2016 2016 2016 2016 2016 2016 2016 2016
## [196] 2016 2016 2016 2016 2016 2016 2016 2016 2016 2016 2016 2016 2016 2016 2016
## [211] 2016 2016 2016 2016 2016 2016 2016 2016 2016 2016 2016 2016 2016 2016 2016
## [226] 2016 2016 2016 2016 2016 2016 2016 2016 2016 2016 2016 2016 2016 2016 2016
## [241] 2016 2016 2016 2016 2016 2016 2016 2016 2016 2017 2017 2017 2017 2017 2017
## [256] 2017 2017 2017 2017 2017 2017 2017 2017 2017 2017 2017 2017 2017 2017 2017
## [271] 2017 2017 2017 2017 2017 2017 2017 2017 2017 2017 2017 2017 2017 2017 2017
## [286] 2017 2017 2017 2017 2017 2017 2017 2017 2017 2017 2017 2017 2017 2017 2017
## [301] 2017 2017 2017 2017 2017 2017 2017 2017 2017 2017 2017 2017 2017 2017 2017
## [316] 2017 2017 2017 2017 2017 2017 2017 2017 2017 2017 2017 2017 2017 2017 2017
## [331] 2017 2017 2017 2017 2017 2017 2017 2017 2017 2017 2017 2017 2017 2017 2017
## [346] 2017 2017 2017 2017 2017 2017 2017 2017 2017 2017 2017 2017 2017 2017 2017
## [361] 2017 2017 2017 2017 2017 2017 2017 2017 2017 2017 2017 2017 2017 2017 2017
## [376] 2017 2017 2017 2017 2017 2017 2017 2017 2018 2018 2018 2018 2018 2018 2018
## [391] 2018 2018 2018 2018 2018 2018 2018 2018 2018 2018 2018 2018 2018 2018 2018
## [406] 2018 2018 2018   NA 2018 2019 2019 2019 2019 2019 2019 2019 2019 2019 2019
## [421] 2019 2019 2019 2019 2019 2019 2019 2019 2019 2019 2019 2019 2019 2019 2019
## [436] 2019 2019 2019 2019 2019 2019 2019 2019 2019 2019 2019   NA 2019 2019 2019
## [451] 2019 2019 2019 2019 2019 2019 2019 2019 2019 2019 2019 2019 2019 2019 2019
## [466] 2019 2019 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020
## [481] 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020
## [496] 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020
## [511] 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020
## [526] 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020
## [541] 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020
## [556] 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020
## [571] 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020
## [586] 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2021 2021 2021
## [601] 2021 2021 2021 2021 2021 2021 2021 2021 2021 2021 2021 2021 2021 2021 2021
## [616] 2021 2021 2021 2021 2021 2021 2021 2021 2021 2021 2021 2021 2021 2021 2021
## [631] 2021 2021 2021 2021 2021 2021 2021 2021 2021 2021 2021 2021 2021 2021 2021
## [646]   NA 2021 2021 2021 2021 2021 2021 2021 2021 2021 2021 2021 2021 2021 2021
## [661] 2021 2021 2021 2021 2021 2021 2021 2021 2021 2021 2021 2021 2021 2021 2021
## [676] 2021 2021 2021 2021 2021 2021 2021 2021 2021 2021 2021 2021 2021 2021 2021
## [691] 2021 2021 2021 2021 2021 2021 2021 2021 2021 2021 2021 2021 2021 2021 2021
## [706] 2021 2021 2021 2021 2021 2021 2021 2021 2021 2021 2021 2021 2021 2021 2021
## [721] 2021 2021 2021 2021 2021 2021 2021 2021 2021 2021 2021 2021 2021 2021 2021
## [736] 2021 2021 2021 2021 2021 2021 2021 2021 2021 2021 2021 2021 2021 2021 2022
## [751] 2023 2022 2022 2022 2022 2022 2022 2022 2022 2022 2022 2022 2022 2022 2022
## [766] 2022 2022 2022 2022 2022 2022 2022 2022 2022 2022 2022 2022 2022 2022 2022
## [781] 2022 2022 2022 2022 2022 2022 2022 2022 2022 2022 2022 2022 2022 2022 2022
## [796] 2022 2022 2022 2022 2022 2022 2022 2022 2022 2022 2022 2022 2022 2022 2022
## [811] 2022 2022 2022 2022 2022 2022 2022 2022 2022 2022 2022 2022 2022 2022 2022
## [826] 2022 2022 2022 2022 2022 2022 2022 2022 2022 2022 2022 2022 2022 2022 2022
## [841] 2022 2022 2022 2022 2022 2022 2022 2022 2022 2022 2022 2022 2022 2022 2022
## [856] 2022 2022 2022 2022 2022 2022 2022 2022 2022 2022 2022 2022 2022 2022 2022
## [871] 2022 2022 2022 2022 2022 2022 2022 2022 2022 2022
GTBK_outings <- GTBK_data %>%
      group_by(mes) %>%
      count(mes)

GTBK_recapturas <- GTBK_data %>%
  filter(numero_recaptura %in% c(2, 3, 4)) %>%
  group_by(mes) %>%
  count(mes)

full_join(GTBK_outings, GTBK_recapturas, by = "mes") %>%
   mutate(tortugas_por_esfuerzo = n.y/n.x) %>%
   select(mes, tortugas_por_esfuerzo) %>%
   ggplot(aes(x = mes, y = tortugas_por_esfuerzo)) +
   geom_col() 
## Warning: Removed 1 rows containing missing values (`position_stack()`).

# install.packages("ggalluvial")
library(ggalluvial)

Sankey <- GTBK_data %>% 
  filter(numero_recaptura %in% c(3,4)) %>%
  mutate(yearmonth = paste(año, mes, sep = "-")) %>%
  select(marca_nombre, año) %>%
  group_by(marca_nombre, año) %>%
  summarize(n = n()) %>%
  arrange(año) #%>%
## `summarise()` has grouped output by 'marca_nombre'. You can override using the
## `.groups` argument.
  # pivot_wider(
  #   names_from = año,
  #   values_from = n
  # ) 

Sankey <- replace(Sankey,is.na(Sankey),0) %>%
   mutate(frequency = n())


Sankey %>%
  group_by(marca_nombre) %>%
  ggplot(
    aes(
         y = n, 
         axis1 = año, 
         axis2 = marca_nombre
         )
       ) +
  geom_alluvium(aes(fill = marca_nombre)) + 
  geom_stratum(width = 1/12, fill = "black", color = "grey") +
  geom_label(stat = "stratum", aes(label = after_stat(stratum))) #+

  #scale_x_discrete(limits = c("GT 1569", "GT 3843", "GT 3845", "GT 5297", "GT 8120", "GT 8187", "GT 11489", "GT 12261", "GT 15826"))

GTBK Turtle Capture Visualizations

# This code chunk is not to be messed with under any circumstance!
#GTBK_data <- 
# GTBK_data %>%
#   mutate(yearmonth = ym(paste(año, mes, sep = "-")))

tortugas_por_tiempo <- GTBK_data %>%   #counting every time they caught a turtle
  filter(numero_recaptura %in% c(1, 2, 3, 4)) %>%
  group_by(fecha, mes, año) %>%
  drop_na(marca_nombre) %>%
  summarize(turtles = n()) %>%
  group_by(mes, año) %>%
  summarize(total_turtles = sum(turtles, na.rm = T))
## `summarise()` has grouped output by 'fecha', 'mes'. You can override using the
## `.groups` argument.
## `summarise()` has grouped output by 'mes'. You can override using the `.groups`
## argument.
tiempo <- GTBK_data %>%    # of times they went out
  distinct(fecha, mes, año) %>%
  group_by(mes, año) %>%
  summarize(effort = n())
## `summarise()` has grouped output by 'mes'. You can override using the `.groups`
## argument.
full_join(tiempo, tortugas_por_tiempo, by = c("mes", "año")) #%>%
## # A tibble: 97 × 4
## # Groups:   mes [13]
##      mes   año effort total_turtles
##    <dbl> <dbl>  <int>         <int>
##  1     1  2015      5             5
##  2     1  2016      3             3
##  3     1  2017      8             8
##  4     2  2015      3             3
##  5     2  2016      1             1
##  6     2  2017      4             4
##  7     2  2018      1             1
##  8     2  2020      2             2
##  9     2  2021      3             3
## 10     2  2022      1            NA
## # … with 87 more rows
#    mutate(tortugas_por_esfuerzo = n.y/n.x) %>%
#    select(mes, tortugas_por_esfuerzo) %>%
#    ggplot(aes(x = mes, y = tortugas_por_esfuerzo)) +
#    geom_col() 
library(lubridate)

tortugas_por_tiempo <- GTBK_data %>%   #counting every time they caught a turtle
  filter(numero_recaptura %in% c(1, 2, 3, 4)) %>%
  group_by(fecha, mes, año) %>%
  drop_na(marca_nombre) %>%
  summarize(turtles = n()) %>%
  group_by(mes, año) %>%
  summarize(total_turtles = sum(turtles, na.rm = T))
## `summarise()` has grouped output by 'fecha', 'mes'. You can override using the
## `.groups` argument.
## `summarise()` has grouped output by 'mes'. You can override using the `.groups`
## argument.
tiempo <- GTBK_data %>%    # of times they went out
  distinct(fecha, mes, año) %>%
  group_by(fecha, mes, año) %>%
  summarize(effort = n())
## `summarise()` has grouped output by 'fecha', 'mes'. You can override using the
## `.groups` argument.
Capturas_y_ezfuerzo <- full_join(tiempo, tortugas_por_tiempo, by = c("mes", "año")) %>%
  mutate(tortugas_por_esfuerzo = total_turtles/effort) %>%
  mutate(year_month = ym(paste(año, mes, sep = "-"))) 
## Warning: There was 1 warning in `mutate()`.
## ℹ In argument: `year_month = ym(paste(año, mes, sep = "-"))`.
## ℹ In group 218: `fecha = NA`, `mes = NA`.
## Caused by warning:
## ! All formats failed to parse. No formats found.
Capturas_y_ezfuerzo %>% 
  ggplot(
    aes(x = year_month,
        y = tortugas_por_esfuerzo
      )
  ) +
  geom_line()
## Warning: Removed 1 row containing missing values (`geom_line()`).

Capturas_y_ezfuerzo %>% 
  ggplot(
    aes(x = year_month,
        y = tortugas_por_esfuerzo
      )
  ) +
  geom_col()
## Warning: Removed 4 rows containing missing values (`position_stack()`).

GTBK_data %>%
  mutate(yearmonth = ym(paste(año, mes, sep = "-")))
## Warning: There were 3 warnings in `mutate()`.
## The first warning was:
## ℹ In argument: `yearmonth = ym(paste(año, mes, sep = "-"))`.
## ℹ In group 1: `marca_nombre = ""`.
## Caused by warning:
## !  1 failed to parse.
## ℹ Run ]8;;ide:run:dplyr::last_dplyr_warnings()dplyr::last_dplyr_warnings()]8;; to see the 2 remaining warnings.
## # A tibble: 880 × 39
## # Groups:   marca_nombre [767]
##    nombre_to…¹ estac…² fecha               area_…³ posic…⁴ hora_…⁵ especie  peso
##    <chr>       <chr>   <dttm>              <chr>   <chr>   <chr>   <chr>   <dbl>
##  1 Lencho      <NA>    2010-10-11 00:00:00 ISPM    N28º37… 0.1458… Chelon…  15  
##  2 Lili        <NA>    2010-10-12 00:00:00 ISPM    N28º37… <NA>    Chelon…  18  
##  3 Alejandra … <NA>    2010-10-12 00:00:00 ISPM    <NA>    <NA>    Chelon…  17.5
##  4 Ana  Luisa  <NA>    2010-10-12 00:00:00 ISPM    N28º22… <NA>    Chelon…  27  
##  5 Naomi       Primav… 2011-03-15 00:00:00 ISPM    N28371… <NA>    Chelon…  19  
##  6 Romelia     Primav… 2011-03-16 00:00:00 ISPM    N28371… <NA>    Chelon…  17.6
##  7 LORAYNE     Primav… 2011-03-16 00:00:00 ISPM    n28221… <NA>    Chelon…  21.6
##  8 profepa     Verano  2012-10-08 00:00:00 choyud… <NA>    <NA>    Eretmo…   4  
##  9 prescolina  Otono   2012-05-11 00:00:00 Alcalt… N23.83… 0.5124… Chelon…  32  
## 10 PAPIRINGO   Invier… 2013-10-01 00:00:00 Pta. B… N28.78… 0.5277… Chelon…  42.8
## # … with 870 more rows, 31 more variables: sexo <chr>, l_r_c <dbl>,
## #   l_c_c <dbl>, a_r_c <dbl>, a_c_c <dbl>, p_c <dbl>, l_p <dbl>, l_t_c <dbl>,
## #   marca_nombre <chr>, marca_izquierda <chr>, fecha_inicio <dttm>,
## #   hora_inicio <dbl>, hora_fin <dbl>, total_horas <dbl>, tipo_monitoreo <chr>,
## #   metodologia <chr>, latitud <dbl>, longitud <dbl>,
## #   unidad_utm_o_grados <chr>, hora_captura <dbl>, material_marcas <chr>,
## #   marca_previa_izquierda <chr>, comentarios <chr>, …
tortugas_por_tiempo <- GTBK_data %>%   #counting every time they caught a turtle
  filter(numero_recaptura %in% c(1, 2, 3, 4)) %>%
  group_by(fecha, mes, año) %>%
  drop_na(marca_nombre) %>%
  summarize(turtles = n()) %>%
  group_by(mes, año) %>%
  summarize(total_turtles = sum(turtles, na.rm = T))
## `summarise()` has grouped output by 'fecha', 'mes'. You can override using the
## `.groups` argument.
## `summarise()` has grouped output by 'mes'. You can override using the `.groups`
## argument.
tiempo <- GTBK_data %>%    # of times they went out
  distinct(fecha, mes, año) %>%
  group_by(mes, año) %>% 
  summarize(effort = n())
## `summarise()` has grouped output by 'mes'. You can override using the `.groups`
## argument.
tortugas_por_esfuerzo <- full_join(tortugas_por_tiempo, tiempo) %>%
   mutate(esfuerzo = total_turtles/effort)
## Joining with `by = join_by(mes, año)`
full_join(tortugas_por_tiempo, tiempo) %>%
   mutate(esfuerzo = total_turtles/effort) %>%
    # group_by(año) %>%
   ggplot(aes(x = año, y = esfuerzo, fill = mes)) +
   geom_col(position="stack")
## Joining with `by = join_by(mes, año)`
## Warning: Removed 3 rows containing missing values (`position_stack()`).

full_join(tortugas_por_tiempo, tiempo) %>%
   mutate(esfuerzo = total_turtles/effort) %>%
  group_by(año) %>%
   ggplot(aes(x = mes, y = esfuerzo, color = as.factor(año))) +
   geom_line()
## Joining with `by = join_by(mes, año)`
## Warning: Removed 3 rows containing missing values (`geom_line()`).

#insert heat map
#heatmap(tortugas_por_esfuerzo)

Turtle Photos/Memes

A Green sea turtle hatchling headed toward the sea.

A Green sea turtle hatchling headed toward the sea.

A Hawksbill sea turtle laying her nest on Buck Island.

A Hawksbill sea turtle laying her nest on Buck Island.